]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionPrefs: Avoid a runtime warning
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Apr 2017 15:00:10 +0000 (17:00 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Apr 2017 17:18:23 +0000 (19:18 +0200)
Since 5b3fb024be, the main window is only shown when not launched
with a valid UUID. As GtkDialog isn't meant to be used standalone,
we currently trigger a (harmless but annoying) warning in case
the main window isn't shown; we can avoid the warning by setting
up the preference dialog manually instead of using the GtkDialog
convenience class.

https://bugzilla.gnome.org/show_bug.cgi?id=781545

js/extensionPrefs/main.js

index 6c536aa1f5bf30c50e2201a2571e2cc1c726b862..457ab6c1dafd455e33dcece5dc0fed5add67c964 100644 (file)
@@ -5,6 +5,7 @@ const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
+const Gdk = imports.gi.Gdk;
 const Pango = imports.gi.Pango;
 const Format = imports.format;
 
@@ -92,9 +93,11 @@ const Application = new Lang.Class({
             widget = this._buildErrorUI(extension, e);
         }
 
-        let dialog = new Gtk.Dialog({ use_header_bar: true,
-                                      modal: true,
-                                      title: extension.metadata.name });
+        let dialog = new Gtk.Window({ modal: !this._skipMainWindow,
+                                      type_hint: Gdk.WindowTypeHint.DIALOG });
+        dialog.set_titlebar(new Gtk.HeaderBar({ show_close_button: true,
+                                                title: extension.metadata.name,
+                                                visible: true }));
 
         if (this._skipMainWindow) {
             this.application.add_window(dialog);
@@ -107,7 +110,7 @@ const Application = new Lang.Class({
         }
 
         dialog.set_default_size(600, 400);
-        dialog.get_content_area().add(widget);
+        dialog.add(widget);
         dialog.show();
     },